<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
        </script>
        <script>
            window.onload = function () {
                token();
            }

            function token() {
                $.ajax({
                    url: "http://localhost:9002/api/user/info",
                    type: "GET",
                    success: function (req) {
                        let item = localStorage.getItem("token");
                        if (item) {
                            alert(item);
                            $("#name").text(req + "欢迎登录系统！");
                        }else {
                            window.location.replace('login.html')
                        }

                    },
                    error: function () {
                        window.location.replace('login.html')
                    }
                });
            }
        </script>
        <title>欢迎</title>
    </head>
    <body>
        <div id="name">欢迎登录系统！</div>
    </body>
</html>